# -*- coding:utf-8 -*-

from PageClass import CashierAuditPage
from TestCases.common.loginDepend import LoginDepend
from Util import logger, ZTCCLOUDError


class CashierAudit(object):

    def __init__(self, boeNo, user):
        self.boeNo = boeNo
        self.login = LoginDepend('fscHost', user)
        self._cashierAuditPage = CashierAuditPage(self.login.driver)
        self.__gotoCashierAuditPage()

    def __gotoCashierAuditPage(self):
        self._cashierAuditPage.click_item('出纳审核')

    # 出纳审核同意
    def cashierAudit(self):
        try:
            self._cashierAuditPage.input_selectBoeNum(self.boeNo)
            self._cashierAuditPage.click_selectButton()
            self._cashierAuditPage.click_selectResult()
            self._cashierAuditPage.click_auditButton()
            self._cashierAuditPage.click_submitButton()
        except Exception as e:
            raise ZTCCLOUDError(f'{self.boeNo}，出纳审核同意失败，错误信息：{str(e)}')
